
Optional Listbufs.f

Only Forth Definitions

0 value (listbuf)
: Listbuf:
  Create
  here cell+ ,  \ next list
  cells /allot ;

: (+listbuf)
   cell (listbuf) +! ;

: clear-listbuf   dup cell+ swap ! ;

: list>  ( listbuf -- list )
   dup to (listbuf) @   dup off  (+listbuf) ;

: add   ( val list -- )
   swap over @+ + ! cell swap +! (+listbuf) ;

: list-count  ( list -- addr count )
   @+ cell/ 1- ;

